The lgamma() function returns the natural logarithm of the gamma function of its argument. For an integer n, lgamma(n+1) = ln(fac(n)) where fac is a factorial function.